#ifndef __callstack_H__
#define __callstack_H__

#include "syntax_base.h"

#include <list>
using namespace std;

namespace syntax_analysis
{
	class callstack
	{
	public:
		typedef list<syntax*>::iterator iterator;

	public:
		virtual ~callstack()
		{
			// TODO
		}

	public:

		iterator begin()
		{
			return m_stack.begin();
		}

		iterator end()
		{
			return m_stack.end();
		}

		syntax* pop()
		{
			syntax* syn = m_stack.back();
			m_stack.pop_back();
			return syn;
		}

		void push( syntax *syn )
		{
			m_stack.push_back( syn );
		}

		syntax* top() const
		{
			if( m_stack.size() > 0 )
				return m_stack.back();
			return NULL;
		}

	protected:
		list<syntax*> m_stack;
	};
}

#endif // __callstack_h__
